package com.jp.knowledge.adapter;

import android.content.Context;
import android.widget.TextView;

import com.jp.knowledge.R;
import com.jp.knowledge.model.HeadLine;

import java.util.List;

/**
 * Created by jiayen on 16/11/16.
 */

public class HeadLineAdapter extends  JPBaseAdpter<HeadLine> {
    public HeadLineAdapter(Context context, List<HeadLine> infos) {
        super(context, infos);
    }

    @Override
    protected int getLayoutId(int position) {
        return R.layout.headnav_text_layout;
    }

    @Override
    protected void renderData(JPViewHolder holder, HeadLine item, int position) {
        TextView name = holder.getView(R.id.name);
        name.setText(item.getTypeName());
        if(item.isCheck())
            holder.getConvertView().setBackgroundColor(getContext().getResources().getColor(R.color.bg_color_layout));
        else
            holder.getConvertView()
                    .setBackground(getContext().getResources().getDrawable(R.drawable.normal_click_bg));
    }
}
